<template>
	<view class="content">
		<image class="logo" src="/static/uview/common/logo.png"></image>
		<view class="text-area u-m-b-60">
			<text class="title">{{ $t('component.desc') }}</text>
		</view>
		<u-button @click="switchLang" throttleTime="200">{{ $t('changelang') }}</u-button>
	</view>
</template>

<script>
export default {
	onShow() {
		uni.setNavigationBarTitle({
			title: this.$t('tabbar.component')
		});
		console.log(this.$u.os());
	},
	methods: {
		switchLang() {
			this.$i18n.locale = this.$i18n.locale == 'en' ? 'zh-Hans' : 'en';
			console.log('this.$i18n.locale==', this.$i18n.locale);
			if (this.$u.os() == 'android') {
				uni.showModal({
					content: this.$t('tabbar.component'),
					success: res => {
						if (res.confirm) {
							uni.setLocale(this.$i18n.locale);
						}
					}
				});
			} else {
				uni.setLocale(this.$i18n.locale);
			}
			uni.setNavigationBarTitle({
				title: this.$t('tabbar.component')
			});
		}
	}
};
</script>

<style>
.content {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
}

.logo {
	height: 200rpx;
	width: 200rpx;
	margin-top: 200rpx;
	margin-left: auto;
	margin-right: auto;
	margin-bottom: 50rpx;
}

.text-area {
	display: flex;
	justify-content: center;
}

.title {
	font-size: 36rpx;
	color: #8f8f94;
}
</style>
